﻿#pragma once
#include<iostream>
using namespace std;

class FSM;

class FSMItem
{
    friend class FSM;
public:
    //动作函数
    static void getUp();
    static void gotoSchool();
    static void haveLunch();
    static void doHomework();
    static void sleeping();
    
    //枚举所有状态
    enum State
    {
        GETUP = 0,
        GOTOSCHOOL,
        HAVELUNCH,
        DOHOMEWORK,
        SLEEP
    };
    //枚举所有事件
    enum Events
    {
        EVENT1 = 0,
        EVENT2,
        EVENT3
    };

    //有参构造函数   通过初始化列表赋值
    FSMItem(State curState,Events event,void(*action)(),State nextState)
        :_curState(curState),_event(event),_action(action),_nextState(nextState){}
    
private:
    State _curState;   //现态
    Events _event;     //条件
    void(*_action)();  //动作   (函数指针)
    State _nextState;  //次态

    
};
